__author__ = '荣耀燃尽  世界尽头'
#for循环完成乘法表
for i in range(1,10):
    for j in range(1,i+1):
        print('{0}*{1}={2:<3}'.format(j,i,i*j),end="")
    print()
print("="*60)

for i in range(9,0,-1):
    for j in range(1,i+1):
         print('{0}*{1}={2:<3}'.format(j,i,i*j),end="")
    print()
print("="*60)

for i in range(1,10):
    for k in range(1,10 - i):
        print('%s' % ('       '),end = '')
    for j in range(1,i + 1):
            print('%d*%d=%2d ' % (j, i, j * i),end = '')
    print()
print("="*60)

for i in range(9,0,-1):
    for k in range(0,9 - i):
        print('%s' % ('       '),end = '')
    for j in range(1, i + 1):
        print('%d*%d=%2d ' % (j, i, j * i),end = '')
    print()
print("="*60)
#while完成乘法表
i=1
while i<10:
    j=1
    while j<i+1:
        print('{0}*{1}={2:<3}'.format(j,i,i*j),end="")
        j+=1
    i+=1
    print()
print("="*60)

i=9
while i>0:
    j=1
    while j<=i:
        print('{0}*{1}={2:<3}'.format(j,i,i*j),end="")
        j+=1
    i-=1
    print()
print("="*60)

i = 1
while i < 10:
    k = 1
    while k < 10 - i:
        print('%s' % ('       '),end = '')
        k += 1
    j = 1
    while j < i + 1:
        print('%d*%d=%2d ' % (j, i, j * i),end = '')
        j += 1
    i += 1
    print()
print("="*60)
i = 9
while i > 0:
    k = 0
    while k < 9 - i:
        print('%s' % ('       '),end = '')
        k += 1
    j = 1
    while j < i + 1:
        print('%d*%d=%2d ' % (j, i, j * i),end = '')
        j += 1
    i -= 1
    print()
print("="*60)